﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel.DataAnnotations;

namespace Upreader.Application.Model
{
    /// <summary>
    /// Basic imlementation for each model, supporting IExtensibleDataObject
    /// </summary>
    public class ModelBase
    {
        /// <summary>
        /// Determines wether the current model and the given are equal
        /// </summary>
        public override bool Equals(object other)
        {
            if (other == null)
                return false; // never equal to null

            if (this.GetType() != other.GetType())
                return false;

            return this.Id == ((ModelBase)other).Id;
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }

        /// <summary>
        /// Get or set the Id of this model
        /// </summary>
        public int Id { get; set; }
    }
}
